﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Feedback : System.Web.UI.Page
{
    AccessDAO dao = new AccessDAO();
    protected void Page_Load(object sender, EventArgs e)
    {
        string s2 = "select * from billInfo where id=1";
        DataSet ds2 = dao.getDs(s2);
        this.dlProdu.DataSource = ds2;
        this.dlProdu.DataBind();
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string name = this.txtname.Value;
        string sex = "";
        if (this.rad1.SelectedValue.Equals("男"))
        {
            sex = "先生";
        }
        else
        {
            sex = "女士";
        }

        string email = this.txtemail.Value;
        string address = this.txtcity.Value;
        string tel = this.txttel.Value;
        string content = this.txtcontent.Value;
        string title = this.txttitle.Value;

        string time = DateTime.Now.ToString();

        string ss = "insert into messageInfo(messname,messsex,messaddress,messtelep,messemail,messtitle,content,messTime) values('" + name + "','" + sex + "','" + address + "','" + tel + "','" + email + "','" + title + "','" + content + "','" + time + "')";
        if (dao.getComm(ss) != 0)
        {
            RegisterStartupScript("check", "<script language='javascript'>alert('留言成功');</script>");
            Server.Transfer("GuestBook.aspx");
        }
        else
        {
            RegisterStartupScript("check", "<script language='javascript'>alert('留言失败');</script>");
        }
    }
}
